<template>
 <el-dialog v-model="dialogVisible" title="编辑用户" width="90%" destroy-on-close>
    <template #footer>
        <StudentEditVue :data="data"></StudentEditVue>
         <span class="dialog-footer">
           <el-button type="primary" @click="submit">
             确认
           </el-button>
           <el-button type="primary" @click="dialogVisible = false">
             取消 
           </el-button>      
         </span>
       </template>
</el-dialog>
</template>
<script>
import { Edit } from '@element-plus/icons-vue'
import StudentEditVue from '@/page/StudentEdit.vue';
export default {
       name: 'EDIT_USER_TABLE',
       props:["userList"],
       components:{
           Edit,StudentEditVue
    },
    data: function(){
       return {
           dialogVisible:false,
           data:{},
           formData:{
               phone:""
           }
       }
       },
        methods:{ 
            submit(){
                var that = this;
                this.formData.userUuid = sessionStorage.getItem('token1');
                window.sessionStorage.setItem('token',this.formData)
                window.http.post('/api/user/revise',this.formData).then(res => {
                console.info(JSON.stringify(res));
                var data = res.data;
                if(data.success){
                    that.$message.success('编辑成功');
                }else{
                    that.$message.error('编辑失败');
                } 
                })
                .catch(function(error){
                that.$message.error('服务器异常');
                })
            }, 
        },
        mounted(){
            var that = this;
            this.$bus.on("editUserStuDialog",function(row){
                that.dialogVisible = true;
                that.data = row;
                // that.formData.phone ="";
            })
       },
        unmounted(){
            this.$bus.off("editUserStuDialog")
       }
    }
   </script>
       <style>
       html,
       body, 
       #app{
       height: 100%;
       }
       </style>
       <style scoped>
       .container {
       display: flex;
       flex-direction: column;
       align-items: center;
       justify-content: center;
       width: 100%;
       height: 100%;
   
       }
       .tr{
       width: 200px;
       flex-basis: 50px;
       display: flex;
       flex-direction: row;
       justify-content: space-between;
       background-color: beige;
       align-items: center;
       }
       .second{
       background-color: aqua;
       }
       </style>